/**
 * 单个TODO项
 */

 /**
 * TODO页面的入口
 */

 /**
 * Todo主控件的入口
 */
import { Stream } from 'xstream';
import { VNode } from '@cycle/dom';
import { TodoSources, TodoSinks, TodoReducer, TodoAction } from '../../types';
import intent from './intent';
import model from './model';
import view from './view';

/**
 * 返回App的组件
 * @param sources 
 */
export default function Todo(sources : TodoSources) : TodoSinks
{

    const actions : TodoAction = intent(sources.DOM);
    const reducer$ = model(actions);
    const vdom$ : Stream<VNode> = view(sources.onion.state$);
    return {
        DOM: vdom$,
        onion: reducer$
    };
}